// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include <xtl.h>
#include <xboxmath.h>

#include "../XePS2.spa.h"

// TODO: reference additional headers your program requires here
#include <xui.h>
#include <xuiapp.h>
#include <iostream>
#include <vector>

#ifndef _DEBUG
#define printf(x)
#endif

typedef UCHAR u8;
typedef unsigned short u16;
typedef unsigned u32;
typedef unsigned long long u64;

typedef char s8;
typedef signed short s16;
typedef signed s32;
typedef long long s64;

typedef u32 uint;
typedef u32 uptr;
typedef s32 sptr;
/*
union u128
{
	struct  
	{
		u64 lo;
		u64 hi;
	};

	u64 _u64[2];
	u32 _u32[4];
	u16 _u16[8];
	u8  _u8[16];

	// Explicit conversion from u64. Zero-extends the source through 128 bits.
	static u128 From64( u64 src )
	{
		u128 retval;
		retval.lo = src;
		retval.hi = 0;
		return retval;
	}

	// Explicit conversion from u32. Zero-extends the source through 128 bits.
	static u128 From32( u32 src )
	{
		u128 retval;
		retval._u32[0] = src;
		retval._u32[1] = 0;
		retval.hi = 0;
		return retval;
	}

	operator u32() const { return _u32[0]; }
	operator u16() const { return _u16[0]; }
	operator u8() const { return _u8[0]; }
	
	bool operator==( const u128& right ) const
	{
		return (lo == right.lo) && (hi == right.hi);
	}

	bool operator!=( const u128& right ) const
	{
		return (lo != right.lo) || (hi != right.hi);
	}
};

struct s128
{
	s64 lo;
	s64 hi;

	// explicit conversion from s64, with sign extension.
	static s128 From64( s64 src )
	{
		s128 retval = { src, (src < 0) ? -1 : 0 };
		return retval;
	}

	// explicit conversion from s32, with sign extension.
	static s128 From64( s32 src )
	{
		s128 retval = { src, (src < 0) ? -1 : 0 };
		return retval;
	}

	operator u32() const { return (s32)lo; }
	operator u16() const { return (s16)lo; }
	operator u8() const { return (s8)lo; }

	bool operator==( const s128& right ) const
	{
		return (lo == right.lo) && (hi == right.hi);
	}

	bool operator!=( const s128& right ) const
	{
		return (lo != right.lo) || (hi != right.hi);
	}
};

*/


typedef void FnType_Void();
typedef FnType_Void* Fnptr_Void;
/*
#define PCSX2_PAGESIZE		0x1000

static const int __pagesize	= PCSX2_PAGESIZE;*/
#define __packed
#define __aligned(alig)	__declspec(align(alig))
#define __aligned16		__declspec(align(16))
#define __aligned32		__declspec(align(32))
#define __pagealigned	__declspec(align(PCSX2_PAGESIZE))

using namespace std;

#include "CMyMainScene.h"
#include "CChangeDirectoryScene.h"
#include "SimpleIni.h"
#include "Settings.h"
#include "Storage.h"

#include "Common.h"
#include "MemoryTypes.h"

#include "MemcpyFast.h"

#define SIF_LOG

#define BIOS_LOG
#define CPU_LOG
#define COP0_LOG
#define VUM_LOG
#define MEM_LOG
#define CACHE_LOG
#define HW_LOG
#define UnknownHW_LOG
#define DMA_LOG
#define IPU_LOG
#define VIF_LOG
#define SPR_LOG
#define GIF_LOG
#define MSKPATH3_LOG
#define EECNT_LOG
#define VifCodeLog
#define GifTagLog


#define PSXBIOS_LOG
#define PSXCPU_LOG
#define PSXMEM_LOG
#define PSXHW_LOG
#define PSXUnkHW_LOG
#define PSXDMA_LOG
#define PSXCNT_LOG
#define MEMCARDS_LOG
#define PAD_LOG
#define GPU_LOG
#define CDVD_LOG